package com.hemi.rhet;

import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.webkit.WebView;
import android.widget.Toast;

public class PostView  extends WebView {
		Context context;
		GestureDetector gd;
		public PostView(Context context) {
			super(context);
			this.context = context;
			gd = new GestureDetector(context, sogl);
		}

		@Override
		public boolean onTouchEvent(MotionEvent event) {
			return gd.onTouchEvent(event);
		}

		GestureDetector.SimpleOnGestureListener sogl = new GestureDetector.SimpleOnGestureListener() {
			public boolean onDown(MotionEvent event) {
				return true;
			}
			public boolean onFling(MotionEvent event1, MotionEvent event2,
					float velocityX, float velocityY) {
				if (event1.getRawX() > event2.getRawX()) {
					show_toast("swipe left");
				} else if(event1.getRawX() < event2.getRawX()){
					show_toast("swipe right");
				}else{
					
					
				}
				return true;
			}
		};

		void show_toast(final String text) {
			Toast t = Toast.makeText(context, text, Toast.LENGTH_SHORT);
			t.show();
		}
}
